<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script>
window.onload=function()
{
		var oUl = document.getElementById('ul1');
	 var oA = document.getElementsByTagName('a');
	
		for(var i=0;i<oA.length;i++)
			{
				(function(i)
				{
					oA[i].onclick = function()
					{
							this.parentNode.style.display = 'none';
							alert(i);
					}
				})(i);
			}
		
};
</script>
</head>

<body>
<ul id="ul1">
	<li>test1 <a href="javascript:;">隐藏</a></li>
	<li>test2 <a href="javascript:;">隐藏</a></li>
	<li>test3 <a href="javascript:;">隐藏</a></li>
	<li>test4 <a href="javascript:;">隐藏</a></li>
	<li>test5 <a href="javascript:;">隐藏</a></li>
</ul>
</body>
</html>
